<template>
  <div>
    <home-header></home-header>
    <home-swiper :swiper="swiper"></home-swiper>
    <home-icons :iconList="icon"></home-icons>
    <home-content :content="content"></home-content>
    <home-weekend :weekend="weekend"></home-weekend>
  </div>
</template>

<script>
import HomeHeader from './components/Header'
import HomeSwiper from './components/Swiper'
import HomeIcons from './components/Icons'
import HomeContent from './components/Content'
import HomeWeekend from './components/Weekend'
import axios from 'axios'
export default {
  name: 'Home',
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeContent,
    HomeWeekend
  },
  data () {
    return {
      swiper: [],
      icon: [],
      content: [],
      weekend: []
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('/api/index.json').then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.city = data.city
        this.swiper = data.swiperList
        this.content = data.contentList
        this.icon = data.iconList
        this.weekend = data.weekendList
      }
    }
  },
  mounted () {
    console.log('挂载完成了')
    this.getHomeInfo()
  }
}
</script>

<style>
</style>
